<?php
class Home_Controller_Hand extends Home_Controller_Base{
    public function init(){
        $this->assign('active','hand');
        parent::init();
    }

    //云手列表页
    public function actionList(){
        $this->_setType(array('index'=>PARAM_STRING));
        $index = $this->_get('index');
        $condition = array();
        $indexArr = explode('-', $index);

        if(count($indexArr) == 3){
            list($hand_goodat_field, $hand_goodat_industry, $hand_area) = $indexArr;
            if(!!$hand_goodat_field) $condition['hand_goodat_field'] = array('symbol'=>'like','value'=>'%'.$hand_goodat_field.'%');
            if(!!$hand_goodat_industry) $condition['hand_goodat_industry'] = array('symbol'=>'like','value'=>'%'.$hand_goodat_industry.'%');
            if(!!$hand_area) $condition['hand_area'] = array('symbol'=>'=','value'=>$hand_area);
        }

        $model_hand = MONK::getSingleton('Home_Model_Hand');
        //获取云手列表
        $hands = $model_hand->get_list($condition);
        $this->assign('hands',$hands);
        //擅长领域列表
        $fields = $model_hand->_goodat_field;
        $this->assign('fields',$fields);
        //擅长行业列表
        $industrys = $model_hand->_industry;
        $this->assign('industrys',$industrys);
        //业务地区列表
        $areas = $model_hand->_hand_area;
        $this->assign('areas',$areas);
        //分页
        $totalCount = $model_hand->get_all_count_has_checked();
        $pagelink = $this->getDefaultPageLink($indexArr, $totalCount);
        $this->assign('pagelink',$pagelink);
        $this->render();
    }

    //云手详情页
    public function actionDetail(){
        $this->render();
    }
}
